/*
https://leetcode-cn.com/problems/reaching-points/solution/dao-da-zhong-dian-by-leetcode/
 */
public class Solution780 {
    public boolean reachingPoints(int sx, int sy, int tx, int ty) {
        while (tx>sx && ty>sy){
            if (tx<ty){
                ty=ty%tx;
            }else{
                tx=tx%ty;
            }
        }
        if (tx==sx){
            return ty>=sy && (ty-sy)%sx==0;
        }else if (ty==sy){
            return tx>=sx && (tx-sx)%sy==0;
        }else {
            return false;
        }
    }

    public static void main(String[] args) {
        System.out.println(new Solution780().reachingPoints(1,1,3,5));
    }
}
